import React, { ReactElement } from "react";
import { RouteComponentProps, StaticContext } from "react-router";

export interface LocationState {
    redirect?: string;
}

export interface MergeRouteComponentProps
    extends RouteComponentProps<{}, StaticContext, LocationState> {
    routes?: RouteConfig[];
}
export interface RouteConfig {
    path: string;
    component: React.FC<any>; // TODO
    id?: string;
    name?: string;
    routes?: RouteConfig[];
}

export interface MenuConfig {
    name: string;
    id?: string;
    path?: string;
    icon?: ReactElement;
    children?: MenuConfig[];
}

export interface ViewConfig {
    [key: string]: {
        id?: string;
        name: string;
        path: string;
        component: any;
    };
}

export type PreMenu = Array<{
    name?: string;
    icon?: ReactElement;
    code?: string;
    children?: PreMenu;
}>;

export type PreRoutesType = Array<{ code: string; routes?: PreRoutesType }>;
